//window.onload = loadswf;
function loadswf(event){
	var paramsObj = {
        wmode:"Opaque",//window,Transparent,Opaque
		quality:"high",
		bgcolor:"#FFF",
		allowScriptAccess:"sameDomain",
		allowFullScreen:true,
        allowNetworking:"all",
        seamlesstabbing:null,
		menu:false,
        scale:"showall",
        salign:"tl"
//      base:''
//      play:null,
//      loop:null,
//      swliveconnect:null,
//      devicefont:null
//http://kb2.adobe.com/cps/127/tn_12701.html
	};
	var attrObj = {
		id:"",
		name:"",
		align:"middle"
	};
	var swfs = new Array();
	swfs = document.body.getElementsByTagName("loadswf");
	if(swfs.length > 0){
		var n = swfs.length;
		var i = 1;
		while(swfs.length > 0){
			var swfTag = swfs[0];
			var parentElement = swfTag.parentNode;
			var flashFile = swfTag.getAttribute("href");
			if(!flashFile || !parentElement)
				return false;
			var width = swfTag.getAttribute("width") ? swfTag.getAttribute("width") : "300";
			var height = swfTag.getAttribute("height") ? swfTag.getAttribute("height") : "200";
			var version = swfTag.getAttribute("version") ? swfTag.getAttribute("version") : "10.0.0";
			var checkSwf = swfTag.getAttribute("checkUpdate") == "true" ? "./install.swf" : "";
			var attrs = swfTag.attributes;
			var flashVars = {};
			
			attrObj.id = "flash"+i;
			attrObj.name = "flash"+i;
			for(var j = 0; j < attrs.length; j++){
				var tmpNode = attrs[j];
				if(tmpNode.nodeName == "vars"){
					eval("flashVars = ("+tmpNode.value+")");
				}else if(paramsObj[tmpNode.nodeName]){
					paramsObj[tmpNode.nodeName] = tmpNode.value;
				}else if(attrObj[tmpNode.nodeName]){
					attrObj[tmpNode.nodeName] = tmpNode.value;
				}
				//if(tmpNode.value)
					//swfTag.setAttribute(tmpNode.nodeName, null);
					//swfTag.removeAttribute(tmpNode.nodeName);	
			}
			var divElement = document.createElement("div");
			var divID = attrObj.id+"Div";
			divElement.setAttribute("id", divID);
			parentElement.appendChild(divElement);
			parentElement.removeChild(swfTag);
			
			var isIE = navigator.appName.indexOf("Microsoft") != -1;
			//if(isIE){
				swfobject.embedSWF(flashFile, divID, width, height, version, checkSwf, flashVars, paramsObj, attrObj);
			//}else{
			//	var embed = '<embed id="'+attrObj.id+'" src="'+flashFile+'" quality="'+paramsObj['quality']+'" allowFullScreen="'+paramsObj['allowFullScreen']+'" allowNetworking="'+paramsObj['allowNetworking']+'" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="'+width+'" height="'+height+'" allowScriptAccess="'+paramsObj['allowScriptAccess']+'"></embed>';
			//	divElement.innerHTML = embed;
			//}
			i++;
		}
	}
}